<template>
 <div class="item-swiper"  ref="swiper">
  <div class="content">
    <slot></slot>
  </div>
</div>


</template>

<script>
import BScroll from 'better-scroll'
export default {
  props: {
    probeType:{
      type:Number,
       default:0
    },
     pullUpLoad:{
       type:Boolean,
      default:false
     }
    
  
  },
  name:'scroll',
  data () {
    return {
      bscroll:''
    }
  },
  mounted () {
   this.bscroll =new BScroll(this.$refs.swiper,{
      probeType:this.probeType,
      click:true,
      pullUpLoad:this.pullUpLoad
    })
    this.bscroll.on('scroll',(position)=>{
      this.$emit('scroll',position)
    })
    this.bscroll.on('pullingUp',()=>{
      this.$emit('pullingUp')
    })
  },
  methods: {

    scrolltop(x,y,time=500){
    this.bscroll &&  this.bscroll.scrollTo(x,y,time)
    
    },
    finishPullUp(){
    this.bscroll && this.bscroll.finishPullUp()
    },
    refresh(){
    
    this.bscroll && this.bscroll.refresh()
    }

  }
 
}
</script>

<style scoped>

</style>